#include "tablecolumn.h"

TableColumn::~TableColumn()
{
}

TableColumn::TableColumn(TableColumnType type, const string & name):Column(name)
{
    this->type = type;
}

TableColumn::TableColumn(const TableColumn& other):Column(other.name)
{
    type = other.type;
}

void TableColumn::setType(TableColumnType type)
{
    this->type = type;
}

TableColumnType TableColumn::getType()
{
    return type;
}

string TableColumn::toString()
{
    string str = "[NAME: " + name + ", TYPE: ";
    if(type.type == INTEGER) str = str + "INTEGER]";
    else if(type.type == STRING){
		 str = str + "STRING(";
		str += type.size;
		str +=")]";
	}

    return str;
}

TableColumn * TableColumn::clone()
{
    return new TableColumn(*this);
}
